package server.business.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import server.business.mapper.StateMapper;
import server.business.pojo.State;
import server.business.service.StateService;

import java.util.List;
import java.util.Map;

/**
* @author Galaxy
* @description 针对表【state(状态)】的数据库操作Service实现
* @createDate 2022-11-08 12:46:24
*/
@Service("stateService")
public class StateServiceImpl extends ServiceImpl<StateMapper, State>
    implements StateService {
    @Autowired
    private StateService stateService;

    /**
     * 查询数据
     *
     * @return {@link List}<{@link State}>
     */
    public List<State> queryData(){
        List<State> list = stateService.list();
        return list;
    }


    /**
     * fzx
     * @param BloodState
     * @return
     */
    public String getState(String BloodState) {
        QueryWrapper<State> StateType= new QueryWrapper<>();
        StateType
                .lambda()
                .eq(State::getCode,BloodState)
                .select(State::getState);
        List<Map<String, Object>> list = this.listMaps(StateType);
        return ((String) list.get(0).get("state"));

    }
}




